Skip to content

Instantly share code, notes, and snippets.

@mmasashi
mmasashi / encode_for_redshift.rb
Created April 28, 2015 23:45
Encode string for redshift
class RedshiftString
# Redshift supports UTF-8 but it enforces stricter rule than other
# implementations such as MySQL or Ruby. This method returns a
# Redshift-safe string from the given string.
def self.encode(string, options = {})
result = string.encoding == Encoding::UTF_8 ? string.encode(Encoding::UTF_16, options).encode(Encoding::UTF_8) : string.encode(Encoding::UTF_8, options)
result.each_char.collect{|c|
# Per Redshift document
# http://docs.aws.amazon.com/redshift/latest/dg/multi-byte-character-load-errors.html
if c >= "\uFDD0" && c <= "\uFDEF" || c == "\uFFFE" || c == "\uFFFF"
@larryrubin
larryrubin / phonegap_reverse_geo_lookup.html
Created May 4, 2012 08:32
PhoneGap Reverse Geolocation Lookup
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width;height=device-height; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
<title>PhoneGap Reverse Geolocation Lookup</title>
<script type="text/javascript" src="cordova-1.7.0.js"></script>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true"></script>
@ktoraskartwilio
ktoraskartwilio / mixing_recordings.md
Last active July 15, 2025 00:03
Mixing Recordings

When mixing the tracks, we need to consider that they might (and probably have) started at different times. If we were to merge tracks without taking this into account, we would end up with synchronization issues. In our example, since Bob got in the room a good 20s (and that’s really a huge time for synchronization of audios), mixing both Alice’s and Bob’s audio tracks together would end up having one speaking over the other.

To make merging easier, the start time of all tracks from the same room is the creation of the room itself. Let’s get the start times for all the tracks from this room

Get Alice's audio start time

const fs = require('fs');
const { exec, execSync } = require('child_process');
const getStartTime = (fileName) => {
const ffprobeOutput = execSync(`ffprobe -v quiet -print_format json -show_entries format=start_time ${fileName}`).toString();
const ffprobeJSON = JSON.parse(ffprobeOutput);
return parseFloat(ffprobeJSON.format.start_time) * 1000;
};
const mixAudioTracks = (audioFiles) => {
@jlia0
jlia0 / agent loop
Last active July 15, 2025 00:02
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
@seunggabi
seunggabi / semantic-branch-names.md
Last active July 15, 2025 00:00
Semantic Branch Names

Semantic Branch Names

See how a minor change to your branch name style can make you a better programmer.

Format: <type>/#<issueNumber>-<alias>

Example

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 14, 2025 23:59
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@SeniorCub
SeniorCub / locatePhoneNumber.py
Created May 12, 2024 14:11
Locating phone number using python code
import phonenumbers
from phonenumbers import geocoder
phone_number1 = phonenumbers.parse("+917294536271")
phone_number2 = phonenumbers.parse("+2347045661084")
print("\nPhone Numbers Location\n")
print(geocoder.description_for_number(phone_number1,"en"))
print(geocoder.description_for_number(phone_number2,"en"))
@ongkiii
ongkiii / IPA-Sources.md
Last active July 14, 2025 23:58
REPOS/TELEGRAM CHANNELS LIST BY u/angkitbharadwaj